{{ define "page" }}
    <form class="form-horizontal form-label-left" role="form" method="post" id="save-user" novalidate>
        <div class="item form-group">
            <label for="name" class="control-label col-md-3 col-sm-3 col-xs-12">
            {{ i18n "Name" . }} <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <input type="text" class="form-control" name="name" id="name" required="required" value="{{ .user.Name }}">
            </div>
        </div>
        <div class="item form-group">
            <label for="memo" class="control-label col-md-3 col-sm-3 col-xs-12">
            {{ i18n "Memo" . }}
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <input type="text" class="form-control" name="memo" id="memo" value="{{ .user.Memo }}">
            </div>
        </div>
        {{ if eq .username "" }}
        <div class="item form-group">
            <label for="password" class="control-label col-md-3 col-sm-3 col-xs-12">
            {{ i18n "Password" . }} <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <input type="password" class="form-control" name="password" id="password" required="required" value="{{ .user.Password }}">
            </div>
        </div>
        {{ end }}
        <div class="item form-group">
            <label for="group" class="control-label col-md-3 col-sm-3 col-xs-12">
            {{ i18n "Group" . }} <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <select id="group" name="group" class="form-control select2" required="required">
                {{ range $group := .groups }}
                    <option value="{{ $group.Name }}"{{ if eq $group.Name $.user.Group }}selected="selected"{{ end }}>{{ $group.Name }}</option>
                {{ end }}
                </select>
            </div>
        </div>
        <div class="item form-group">
            <label for="group" class="control-label col-md-3 col-sm-3 col-xs-12">
            {{ i18n "Authority" . }}
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                {{ range $authority := .authorities }}
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" class="flat" name="authorities" value="{{ $authority.Name }}" {{ if $authority.IsChecked }} checked="checked"{{ end }}> {{ $authority.Name }}
                        </label>
                    </div>
                {{ end }}
            </div>
        </div>
        <div class="ln_solid"></div>
        <div class="form-group">
            <div class="col-md-6 col-md-offset-3">
            {{ if ne .username "" }}
                <button id="send" type="submit" class="btn btn-warning">{{ i18n "Update" . }}</button>
            {{ else }}
                <button id="send" type="submit" class="btn btn-success">{{ i18n "Create" . }}</button>
            {{ end }}
            </div>
        </div>
    </form>
{{ end }}

{{ define "js" }}
    {{ staticHTML (staticURL "/dashboard/assets/vendors/validator/js/validator.min.js" false) }}
{{ end }}